package com.sgb.kjwl.view.ui.fragment.manage;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;

import com.sgb.kjwl.AppLazyFragment;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.FrOperatingBusinessChildBinding;
import com.sgb.kjwl.di.manage.DaggerEnterpriseManageFragComponent;
import com.sgb.kjwl.di.manage.EnterpriseManageFragModule;
import com.sgb.kjwl.viewmodel.manage.ChildForOperatingBusinessModel;
import com.swgk.core.base.di.AppComponent;

import javax.inject.Inject;

/*
 * Author LiWei
 * Create Time 2021/4/15
 * Description 网站-经营业务-相关子集业务
 * */
public class ChildForOperatingBusiness extends AppLazyFragment {

    @Inject
    ChildForOperatingBusinessModel viewModel;
    private FrOperatingBusinessChildBinding binding;

    private String websiteNo;
    private int mTypeIndex;

    public static ChildForOperatingBusiness newInstance(String websiteNo, int position) {
        ChildForOperatingBusiness fragment = new ChildForOperatingBusiness();
        Bundle args = new Bundle();
        args.putString("websiteNo", websiteNo);
        args.putInt("TYPE_INDEX", position);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    protected void setupFragmentComponent(AppComponent appComponent) {
        super.setupFragmentComponent(appComponent);
        DaggerEnterpriseManageFragComponent.builder().appComponent(appComponent)
                .enterpriseManageFragModule(new EnterpriseManageFragModule(this))
                .build()
                .inject(this);
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        binding = DataBindingUtil.inflate(inflater, R.layout.fr_operating_business_child, container, false);
        if (getArguments() != null) {
            websiteNo = getArguments().getString("websiteNo");
            mTypeIndex = getArguments().getInt("TYPE_INDEX", 0);
        }
        return binding.getRoot();
    }

    @Override
    protected void initView() {
        initFilterData(false);
    }
    private void initFilterData(boolean isLoadMore) {
        switch (mTypeIndex) {
            case 0:

            case 1:
            case 2:
            case 3:
                binding.emptyView.setVisibility(View.VISIBLE);
                break;
            default:
                break;
        }
    }

    @Override
    protected void onLazyLoad() {

    }

}
